<div class="container" style="min-height: 206px;"> 
    <div class="heading"><a id="sidebaropengear" onclick="showSideBarSettings();" href="javascript:void(0);"><img width=16" height="16" src="./images/gear.png" alt="" /></a>Billing Details</div>
<?php $form=$this->beginWidget('CActiveForm', array(
    'id'=>'dispatch-billing-details-form',
    'enableAjaxValidation'=>false,
)); 
?>    
    <script type="text/javascript">
        jQuery().ready(function($){          
             var spinner = $("#Dispatchdetails_techtime" ).spinner({
            min: 0.0,
            max: 1000,
            step: 0.5,
            numberFormat: "n1",
            culture:"us"
            });

            billingtype = $('#Dispatchdetails_billingtype :selected').text();
            checkShowInvoiceLink();
            $('#Dispatchdetails_billingtype').change(function(){
                billingtype =$('#Dispatchdetails_billingtype :selected').text();
                checkShowInvoiceLink()               
            })

            function checkShowInvoiceLink(){
                if(billingtype == 'Billable'){
                    $('#createDispatchInvoiceLink').show();
                }else{
                    $('#createDispatchInvoiceLink').hide();
                }
            }
        });
       
    </script>
    <style>
        .billing-detail-input{
           border: 1px solid #aaaaaa;
           border-radius: 4px;         
           float: left;
           font-family: "Lucida Grande","Lucida Sans Unicode",Verdana,Arial,sans-serif !important;
           margin: 5px 10px 5px 0;
           padding: 3px;
           width:145px;
           max-width:145px;
        }     
        .billing-detail-input[type="checkbox"] 
        {
            width:20px;
        }
        #Dispatchdetails_billnotes{
            height:160px;
            margin-bottom:20px;
        }        
        #Dispatchdetails_techtime{
            width:130px;
            border:none;
            height:15px;
             padding: 0;
             padding-left:10px;
        }
    </style>
    <?php echo $form->errorSummary($dispatch); ?>
    <div class="inside" style="padding-top:0px; padding-bottom:0px;">
        <h5 style="padding-left:11px;"><?php echo $form->labelEx($dispatch,'billingtype'); ?></h5>
        <ul class="links" style="margin-left:0px !important;">
            <li id='blankforvalidation2' style="display:none">&nbsp;</li>
        
            <li>
                <?php echo $form->dropDownList($dispatch,'billingtype',Dropdowns::getList('DispatchBill'),
                array('class'=>'billing-detail-input')); ?>
            </li>
          


        </ul>
    </div>
    <div class="inside" style="padding-top:0px; padding-bottom:0px;">
        <h5 style="padding-left:11px;"><?php echo $form->labelEx($dispatch,'techtime'); ?></h5>
        <ul class="links" style="margin-left:0px !important;">
            <li id='blankforvalidation2' style="display:none">&nbsp;</li>                                            
            <li >
                 <?php echo $form->textField($dispatch,'techtime',array('class'=>'billing-detail-input')); ?> 
                  <!-- <input class="billing-detail-input" type="number" name="Dispatchdetails[techtime]" id="Dispatchdetails_techtime" min="0" max="1000" step="5" value="<?php echo $dispatch->techtime?>"/> -->
            </li>
        </ul>
    </div>
    <div class="inside" id="createDispatchInvoiceLink" style="display:none; padding-top:0px; padding-bottom:0px;">
   
        <ul class="links" style="margin-left:0px !important;">
            <li id='blankforvalidation2' style="display:none">&nbsp;</li>                                            
            <li >
                <?php echo CHtml::link('Create Invoice','#',array('id'=>"btnCreateInvoice")); ?>                 
                <?php foreach($dispatch->invoiceList as $invoice):?>
                    <?php echo CHtml::link($invoice->invoice,array('/invoices/update','invoice'=>$invoice->invoice),array('target'=>'_blank')); ?><br/>
                <?php endforeach; ?>
            </li>
        </ul>
    </div>
    <div class="inside" style="padding-top:0px; padding-bottom:0px;">
        <h5 style="padding-left:11px;">Parts Billable</h5>
        <ul class="links" style="margin-left:0px !important;">
            <li id='blankforvalidation2' style="display:none">&nbsp;</li>                                            
            <li >
                 <?php echo $form->checkBox($dispatch,'billparts',array('class'=>'billing-detail-input')); ?>                  
            </li>
        </ul>
    </div>
     <div class="inside" style="padding-top:0px; padding-bottom:0px;">
        <h5 style="padding-left:11px;"> Bill Notes</h5>
        <ul class="links" style="margin-left:0px !important;">
            <li id='blankforvalidation2' style="display:none">&nbsp;</li>                                            
            <li>
                 <?php echo $form->textArea($dispatch,'billnotes',array('class'=>'billing-detail-input')); ?> 
            </li>
        </ul>
    </div>  
<?php $this->endWidget(); ?>
    
</div>